# myapp/serializers.py
from rest_framework import serializers
from .models import Author, Book


from rest_framework import serializers
from .models import UserType, User


class UserTypeSerializer(serializers.ModelSerializer):
    class Meta:
        model = UserType
        fields = '__all__'


class UserSerializer(serializers.ModelSerializer):
    user_type = UserTypeSerializer(read_only=True)

    class Meta:
        model = User
        fields = ['id', 'name', 'email', 'user_type']